package cn.com.surker.material.dao;

import cn.com.surker.material.entity.MainMaterialExaminePrice;
import cn.com.surker.material.vo.MaterialExaminePriceVo;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * <p>
 * 原材价格审核表 Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2025-01-10
 */
public interface MainMaterialExaminePriceDao extends BaseMapper<MainMaterialExaminePrice> {

    /**
     * 查询过磅过供应商信息
     * @param orgId
     * @param startTime
     * @param endTime
     * @return
     */
    List<MainMaterialExaminePrice> findWeightSupplier(Long orgId, Long supplierId, Long materialId,
                                                      String startTime, String endTime);

    /**
     * 分页查询审核单价数据
     * @param page
     * @param queryWrapper
     * @param <E>
     * @return
     */
    <E extends IPage<MainMaterialExaminePrice>> E findCloudPage(E page,@org.apache.ibatis.annotations.Param(Constants.WRAPPER) Wrapper<MainMaterialExaminePrice> queryWrapper);

    /**
     * 查询审核单价信息
     * @param queryWrapper
     * @return
     */
    List<MainMaterialExaminePrice> findCloudPage(@org.apache.ibatis.annotations.Param(Constants.WRAPPER) Wrapper<MainMaterialExaminePrice> queryWrapper);

    /**
     * 更新云端数据状态
     * @param examinePrice
     * @return
     */
    Integer updateCloudStatus(@Param("examinePrice") MainMaterialExaminePrice examinePrice);

    /**
     * 批量新增
     * @param list
     * @return
     */
    Integer saveBatch(List<MainMaterialExaminePrice> list);

    /**
     * 查询价格是否实体是不是一样
     * @param orgId
     * @param supplierId
     * @param transportId
     * @param materialId
     * @param today
     * @param takeTime
     * @param type 0主材 1运输
     * @return
     */
    MainMaterialExaminePrice findTodayExist(Long orgId, Long supplierId, Long transportId, Long materialId,
                                            String today, String takeTime, Integer type,Double price, Double transportPrice);
    /**
     * 更新云端价格审核信息
     * @param examinePrice
     * @return
     */
    Integer updateCloud(@Param("examinePrice") MainMaterialExaminePrice examinePrice);
    /**
     * 查询是否存在已审核
     * @param orgId
     * @param today
     * @param isCheck
     * @param isFinance
     * @return
     */
    Integer findCheckTotal(Long orgId, String today, Integer isCheck, Integer isFinance);

    /**
     * 查询主材过磅价格信息
     * @return
     */
    List<MaterialExaminePriceVo> findWeightPrice(String dbCode, Long orgId, Long supplierId, Long materialId,
                                                 String startTime, String endTime);
}
